﻿#region Imports
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualBasic.CompilerServices;
using Microsoft.VisualBasic;
using System.Collections.ObjectModel;
#endregion

namespace LinqDemo.Utilities
{
    public static class Utilities
    {
        public static bool IsNumeric(object expression)
        {
            return Information.IsNumeric(expression);
        }

        public static bool IsNull(object expression)
        {
            return Information.IsNothing(expression);
        }

        public static bool IsLinqIterable<T>(ObservableCollection<T> expression, bool checkCount = false)
            where T : new()
        {
            return IsNull(expression) ? false : (checkCount ? expression.Count > 0 : true);
        }

        public static bool IsBoolean(object value)
        {
            try
            {
                bool bln = false;
                Boolean.TryParse((string)value, out bln);
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }
    }
}
